home *** CD-ROM | disk | FTP | other *** search
- /*
- * include file for the ray-tracer
- */
-
- /*
- * (c) 1988 by George Kyriazis
- */
-
- #ifndef NULL
- #define NULL 0
- #endif
-
- #ifndef FALSE
- #define FALSE 0
- #endif
-
- #ifndef TRUE
- #define TRUE !FALSE
- #endif
-
- #define MINT 1e-5
-
- #define MAXLEVEL 3 /* maximum recursion level */
-
- #define SPHERE 0
- #define SQUARE 1
-
- #define ABS(x) ((x)<0?-(x):(x))
- #define MIN(x, y) ((x)<(y)?(x):(y))
-
- struct vector {double x,y,z;};
-
- /* the color structure */
- struct color {
- double r,g,b;
- };
-
- /* the object structure */
- struct obj {
- int type;
- int dummy;
- union data {
- struct sphere {
- struct vector center;
- double radius;
- } sphere;
- struct quad {
- struct vector p1;
- struct vector p2;
- struct vector p3;
- } quad;
- } data;
- double reflection; /* precentage reflection */
- double refraction; /* percentage refraction */
- struct color refl_color; /* reflective color */
- struct color refr_color; /* refractive color */
- struct color ambient; /* ambient color */
- struct color diffuse; /* diffuse color */
- struct color specular; /* specular color */
- double width; /* specular width factor */
- double index; /* index of refraction */
- double refl_diffuse; /* circle of diffusion in reflection */
- double refr_diffuse; /* circle of diffusion in refraction */
- struct vector time; /* motion */
- };
-
- struct light {
- struct vector org;
- double angle;
- };
- #ifndef SOMEDEFS
- /* light source */
- extern struct light light;
-
- /* number of spheres */
- extern int noo;
- extern int nos, nosq;
-
- /* number of tries per pixel */
- extern int tries;
-
- /* eye stuff */
- extern struct vector hor, ver, eye_dir, eye, up;
- extern double fov;
- extern double foc, lens;
-
- /* time information */
- extern double time1, time2;
- extern double time;
-
- /* background cuing */
- extern int bgflag;
- #define NONE 0
- #define X 1
- #define Y 2
- #define Z 3
-
-
- /* the array of spheres */
- #ifdef HOST
- extern struct obj *obj;
- #endif
-
- /* resolution */
- extern int xres, yres;
- #endif
-
- /* the ray structure */
- struct ray {
- struct vector pos; /* origin */
- struct vector dir; /* direction */
- struct obj *obj; /* where the ray comes from */
- double theta; /* the diffusion angle */
- };
-
- /* the intersection structure */
- struct intersect {
- struct obj *obj; /* which object */
- struct obj *objaddr; /* logical address */
- double t; /* where in the ray */
- struct vector n; /* the normal at that point */
- };
-
- #ifndef SOMEDEFS
- /* some statistics variables */
- extern int raycount; /* total number of rays */
- extern int shadowcount; /* total number of shadow rays traced */
- extern int reflectcount; /* total number of reflected rays */
- extern int refractcount; /* total number of refracted rays */
- extern int intersectcount; /* total number of object intersections */
- extern int objtestcount; /* total number of intersection tests */
-
- extern int rayline; /* rays / line */
- extern int shadowline; /* shadow rays / line */
- extern int reflectline; /* reflected rays / line */
- extern int refractline; /* refracted rays / line */
- extern int intersectline; /* object intersections / line */
- extern int objtestline; /* object intersection tests / line */
- #endif
-